package com.example.ref;


import com.example.ref.delete.Where;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

public class Delete<T> extends Statement implements Generic<T>
{
	Class<T> innerClass;
	public Delete(Class<T> _class) {
		innerClass=_class;
	}

	/**
	 * Creates a Where statement
	 * @param field name of field of the class
	 * @param operator a constant from RSQLiteOperator class
	 * @param value string value
	 * @throws Exception if field is not found
	 */
	public Where<T> where(String field,int operator,String value) throws Exception
	{
		return new Where<T>(this,field,operator,value);
	}

	@Override
	public  Integer execute(Context context) throws Exception {
		return RSQLiteDatabaseHelper.delete(null,innerClass,null, context);
	}


	@Override
	public StringBuilder getBuilder() {
		return builder;
	}


	@Override
	public Class<T> getInnerClass() {
		return innerClass;
	}

	@Override
	public Integer execute(SQLiteDatabase database, Context context)
			throws Exception {

		return RSQLiteDatabaseHelper.delete(database,innerClass,null, context);
	}


}
